importClass(android.app.AlertDialog)
importClass(android.content.DialogInterface)
importClass(android.view.LayoutInflater)
importClass(android.widget.EditText)

module.exports = function () {
    // 自定义对话框
    this.customize = function (xml) {

        let customizeDialog = new AlertDialog.Builder(activity)
        let editView = new EditText(activity)
        let edit2 = ui.inflate(xml)
        // customizeDialog.setTitle(title)
        customizeDialog.setView(edit2)
        
        customizeDialog.show()
    }

    // 普通对话框
    this.normalDialog = function (title, message, fun) {
        
        let dialogObj = new AlertDialog.Builder(activity)
        dialogObj.setTitle(title)
        dialogObj.setMessage(message)
        dialogObj.setPositiveButton("确定", new DialogInterface.OnClickListener({
            onClick: function (dia, which) {
                fun()
            }
        }))

        dialogObj.setNegativeButton("关闭", new DialogInterface.OnClickListener({
            onClick: function (dia, which) {
                
            }
        }))

        dialogObj.show()
        
    }


}

